package com.nuedu.corejava.ch6.homework;

public class Rectangle {
	public static void main(String[] args) {
		Rectangle rectangle=new Rectangle(4, 6);
		rectangle.getArea();
		rectangle.getPer();
		rectangle.showAll();
	}


	private int length;
	private int width;

	public Rectangle(int length, int width) {
		super();
		this.length = length;
		this.width = width;
	}

	public int getArea() {
		int area = 0;
		area = length * width;
		return area;
	}

	public int getPer() {
		int per;
		per=(length+width)*2;
		return per;
	}
	void showAll(){
		System.out.println("这个矩形的长为"+length);
		System.out.println("这个矩形的宽为"+width);
		System.out.println("这个矩形的面积为" + getArea());
		System.out.println("这个矩形的周长为"+getPer());
	}
	
}
